package com.alibaba.citrus.cr.sales.plan.facade.service.salesplan.audit;

import com.alibaba.citrus.cr.common.annotation.FacadeInvoker;
import com.alibaba.citrus.cr.sales.plan.api.salesplan.audit.SalesPlanAuditLineWriteService;
import com.alibaba.citrus.cr.sales.plan.functions.salesplan.audit.SalesPlanAuditLineAbility;
import com.alibaba.citrus.cr.sales.plan.functions.salesplan.audit.SalesPlanAuditLineEntity;
import com.alibaba.citrus.cr.sales.plan.sdo.SalesPlanAuditLineSDO;
import com.alibaba.lattice2.epoch.sdk.model.Result;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:zls
 * @date:2021/9/16
 */
@Service
public class SalesPlanAuditLineWriteServiceImpl implements SalesPlanAuditLineWriteService {

    @Override
    @FacadeInvoker
    public Result<String> create(SalesPlanAuditLineSDO salesPlanAuditLineSDO) {
        SalesPlanAuditLineEntity salesPlanAuditLineEntity = SalesPlanAuditLineEntity.of(salesPlanAuditLineSDO);
        String salesPlanAuditLineId = salesPlanAuditLineEntity.save();
        return Result.success(salesPlanAuditLineId);
    }

    @Override
    @FacadeInvoker
    public Result<Boolean> batchCreate(List<SalesPlanAuditLineSDO> salesPlanAuditLineSDOList) {
        SalesPlanAuditLineAbility salesPlanAuditLineAbility = new SalesPlanAuditLineAbility();
        Boolean aBoolean = salesPlanAuditLineAbility.batchCreateSalesPlanAuditLine(salesPlanAuditLineSDOList);
        return Result.success(aBoolean);
    }
}
